@extends('admin.main')

@section('body')
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>{{$_GET['title']}}  | 店外水桶记录</h2>
    </div>
    <div class="cf">
        {{--<div class="fl">--}}
            {{--<a class="btn" id="msg" href="javascript:;" onclick="addGood({{request('shop_id',0),request('bucket_category_id',0)}})">新 增</a>--}}
        {{--</div>--}}

        <!-- 高级搜索 -->
        {{--<div class="search-form fr cf">--}}
            {{--<!-- 高级搜索 -->--}}
            {{--<div class="search-form fr cf">--}}
                {{--<div class="sleft">--}}
                    {{--<input type="text" name="nickname" class="search-input" value=""--}}
                           {{--placeholder="请输入用户昵称或者ID">--}}
                    {{--<a class="sch-btn" href="javascript:;" id="search" url="{{urlAdmin('bucket','getLogList',['shop_id'=>request('shop_id'),'bucket_category_id' =>request('bucket_category_id')])}}"><i--}}
                                {{--class="btn-search"></i></a>--}}
                {{--</div>--}}
            {{--</div>--}}
            {{--<div class="btn-group-click adv-sch-pannel fl">--}}
            {{--<button class="btn">高 级<i class="btn-arrowdown"></i></button>--}}
            {{--<div class="dropdown cf">--}}
            {{--<div class="row">--}}
            {{--<label>更新时间：</label>--}}
            {{--<input type="text" id="time-start" name="time-start" class="text input-2x" value="" placeholder="起始时间" /> ---}}
            {{--<input type="text" id="time-end" name="time-end" class="text input-2x" value="" placeholder="结束时间" />--}}
            {{--</div>--}}
            {{--<div class="row">--}}
            {{--<label>创建者：</label>--}}
            {{--<input type="text" name="nickname" class="text input-2x" value="" placeholder="请输入用户名">--}}
            {{--</div>--}}
            {{--</div>--}}
            {{--</div>--}}
        {{--</div>--}}
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
            <tr>
                <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                <th class="">说明</th>
                <th class="">数量</th>
                <th class="">客户姓名</th>
                <th class="">送水工号</th>
                <th class="">送水工姓名</th>
                <th class="">创建时间</th>
                {{--<th class="">操作</th>--}}
            </tr>
            </thead>
            <tbody>
            @if(count($rows['data']))
                @foreach($rows['data'] as $v)
                    <tr>
                        <td><input class="ids" type="checkbox" name="ids[]" value="{{$v['id']}}"/></td>
                        <td>
                            @if($v['order_id'] && $v['log_id'] && $v['worker_id'])
                                @if($v['type'] == 1)
                                    回桶
                                @else
                                    送桶
                                @endif
                            @elseif(!$v['order_id'] && $v['log_id'] && $v['type'] == 1)
                                导入期初
                            @endif
                        </td>
                        <td>
                            @if($v['type'] == 1) + @else - @endif{{$v['num']}}
                        </td>
                        <td>{{$v['member']['name']}}</td>
                        <td>{{$v['worker']['code']}}</td>
                        <td>{{$v['worker']['name']}}</td>
                        <td><span>{{$v['created_at']}}</span></td>
                        {{--<td>--}}
                            {{--<a href="javascript:;" onclick="showInfo({{$v['id']}})">详情</a>--}}
                        {{--</td>--}}
                    </tr>
                @endforeach
            @else
                <td colspan="12" class="text-center"> aOh! 暂时还没有内容!</td>
            @endif
            </tbody>
        </table>
    </div>
    <div class="page">
        @if($rows['last_page']>1)
            <div>
                @if($rows['prev_page_url'])
                    <a class="prev" href="{{$rows['prev_page_url']}}&bucket_category_id={{$_GET['bucket_category_id']}}&shop_id={{$_GET['shop_id']}}&title={{$_GET['title']}}">&lt;&lt;</a>
                @endif
                @if(count($rows['pageNoList']))
                    @foreach($rows['pageNoList'] as $v)
                        @if($rows['current_page'] == $v)
                            <span class="current">{{$v}}</span>
                        @else
                            <a class="num" href="{{urlAdmin('bucket','getLogList',['page'=>$v,'bucket_category_id'=>request('bucket_category_id'),'shop_id'=>request('shop_id'),'title'=>$_GET['title']])}}">{{$v}}</a>
                        @endif
                    @endforeach
                @endif
                @if($rows['next_page_url'])
                    <a class="next" href="{{$rows['next_page_url']}}&bucket_category_id={{$_GET['bucket_category_id']}}&shop_id={{$_GET['shop_id']}}&title={{$_GET['title']}}">&gt;&gt;</a>
                @endif
                <span class="rows">共 {{$rows['total']}} 条记录</span>
            </div>
        @endif
    </div>
@endsection

@section('script')

    <script type="text/javascript">

        function addGood(shop_id,bucket_category_id){
            if (!(shop_id && bucket_category_id)) {
                layer.tips('非法操作', '#msg', {
                    tips: [1, 'orange'],
                    time: 4000
                });
            } else {
                window.location.href = '{{urlAdmin('bucket','getAddLog',['shop_id'=>request('shop_id'),'bucket_category_id' =>request('bucket_category_id')])}}'
            }
        }

        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var shop_id = $("#sch-sort-txt").attr("data");
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if(shop_id != ''){
                query = 'shop_id=' + shop_id + "&" + query;
            }
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });

        /* 状态搜索子菜单 */
        $(".search-form").find(".drop-down").hover(function(){
            $("#sub-sch-menu").removeClass("hidden");
        },function(){
            $("#sub-sch-menu").addClass("hidden");
        });
    </script>
@endsection
